package com.token.iot.bratterycharging.gateway;

import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.Timer;
import java.util.TimerTask;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CountDownLatch;

import com.outstanding.framework.core.PendingException;

public class Semaphore {

	private String key;

	private String response;

	private CountDownLatch CountDownLatch;

	private Date time;

	private Sender sender;

	public Semaphore(String key, Sender sender) {
		this.key = key;
		this.sender = sender;
		this.time = Calendar.getInstance().getTime();
	}

	public String getKey() {
		return key;
	}

	public void setResponse(String response) {
		this.response = response;
	}

	public CountDownLatch getCountDownLatch() {
		return CountDownLatch;
	}

	public void setCountDownLatch(CountDownLatch countDownLatch) {
		CountDownLatch = countDownLatch;
	}

	public Date getTime() {
		return time;
	}

	public Sender getSender() {
		return sender;
	}

	public void await() throws InterruptedException {
		this.CountDownLatch.await();
	}

	public String getResponse() {
		return response;
	}

	
}
